<?php
namespace App\Admin\Models;
use Common\BaseModel;
class HomeJdPdd extends BaseModel
{
    protected $res;
    protected $redis_key="admin_";
    public function initialize()
    {
        parent::initialize();
        $this->setSource('view_home_jd_pdd');
    }
    public function find_by_id($id){
        return $this->findById($id);
    }

    public function find_by_id_obj($id){
        return $this->findFirstById($id);
    }

    public function findlist(){
        $getlist = $this->find(array(
            'columns'=>'id,name,carousel_id'
        ));
        return $getlist;
    }



    public function find_first_by_type_obj($type){
        $getlist = $this->findFirstByType($type);
        return $getlist;
    }


    public function find_where_list($data){
        $conditions = "";
        if(isset($data['type']) && !empty($data['type'])){
            $conditions = "type='{$data['type']}'";
        }
        $getlist = $this->find(array(
            $conditions
        ))->toarray();
        return $getlist;
    }


}
